﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using Bitis_KeToanThue_Pro_DungChung.Common;

namespace Bitis_KeToanThue_Pro_QuanTri.AccessDatabase
{
   public class DanhMucNhomChuongTrinh
    {
        AccessData ac = new AccessData(1);
        public int sua(int ID, string DienGiai, int thutu)
        {
            SqlParameter[] arrPara = new SqlParameter[3];
            arrPara[0] = new SqlParameter("@ID", SqlDbType.Int);
            arrPara[0].Value = ID;
            arrPara[1] = new SqlParameter("@DienGiai", SqlDbType.NVarChar);
            arrPara[1].Value = DienGiai;
            arrPara[2] = new SqlParameter("@ThuTuSapXep", SqlDbType.Int);
            arrPara[2].Value = thutu;
            DataTable dt = ac.ftblDocDuLieuSP("thuan_qtdanhmucnhomchuongtrinhsua", arrPara);
            return int.Parse(dt.Rows[0]["ErrCode"].ToString());
        }
        public int xoa(int ID)
        {
            SqlParameter[] arrPara = new SqlParameter[1];
            arrPara[0] = new SqlParameter("@ID", SqlDbType.Int);
            arrPara[0].Value = ID;

            DataTable dt = ac.ftblDocDuLieuSP("thuan_qtdanhmucnhomchuongtrinhxoa", arrPara);
            return int.Parse(dt.Rows[0]["ErrCode"].ToString());
        }
        public int them(string diengiai,int thutu)
        {
            SqlParameter[] arrPara = new SqlParameter[2];
            arrPara[0] = new SqlParameter("@DienGiai", SqlDbType.NVarChar);
            arrPara[0].Value = diengiai;
            arrPara[1] = new SqlParameter("@ThuTuSapXep", SqlDbType.Int);
            arrPara[1].Value = thutu;
            DataTable dt = ac.ftblDocDuLieuSP("thuan_qtdanhmucnhomchuongtrinhthem", arrPara);
            return int.Parse(dt.Rows[0]["ErrCode"].ToString());
        }


        public DataTable loadgird()
        {

            return ac.ftblDocDuLieuSP("thuan_qtdanhmucnhomchuongtrinhload", null);
        }
    }
}
